﻿using Microsoft.MixedReality.Toolkit.Utilities;
using System;
using UnityEngine;

namespace MrPP.iot.Guide
{
    public class GuideLine : MonoBehaviour
    {
        [SerializeField]
        private SimpleLineDataProvider _phototype;

        [SerializeField]
        private SimpleLineDataProvider _line = null;
      
        internal void link(Transform next)
        {
            if (_line == null) {
                _line = GameObject.Instantiate(_phototype);
             
                _line.transform.SetParent(this.transform);
            }
            _line.gameObject.SetActive(true);
            _line.SetPoint(0, this.transform.position);
            _line.SetPoint(1, next.position);
        }

        internal void close()
        {
            _line.gameObject.SetActive(false);
        }
    }
}